{include file="public/head"}

<body>
<div id="wrapper">

    <div class="gray-bg dashbard-1">
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-content">
                            <form class="form-horizontal m-t" id="commentForm">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">等级名称：</label>
                                    <div class="col-sm-8">
                                        <input id="name" name="name" minlength="2" type="text" class="form-control" required="" aria-required="true">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">直推人数：</label>
                                    <div class="col-sm-8">
                                        <div class="input-group">
                                            <input id="recommend_count" name="recommend_count" type="text" class="form-control" required="" aria-required="true" onkeyup="value=value.replace(/[^\d]+/g,'')" >
                                            <div class="input-group-addon">人</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">推荐复投奖励：</label>
                                    <div class="col-sm-8">
                                        <div class="input-group">
                                            <input id="rebate_1" name="rebate_1" type="text" class="form-control" required="" aria-required="true" onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" >
                                            <div class="input-group-addon">元</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">推荐奖励：</label>
                                    <div class="col-sm-8">
                                        <div class="input-group">
                                            <input id="rebate_2" name="rebate_2" type="text" class="form-control" required="" aria-required="true" onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" >
                                            <div class="input-group-addon">%</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">管理奖1代：</label>
                                    <div class="col-sm-8">
                                        <div class="input-group">
                                            <input id="rebate_3" name="rebate_3" type="text" class="form-control" required="" aria-required="true" onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" >
                                            <div class="input-group-addon">%</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">管理奖2代：</label>
                                    <div class="col-sm-8">
                                        <div class="input-group">
                                            <input id="rebate_4" name="rebate_4" type="text" class="form-control" required="" aria-required="true" onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" >
                                            <div class="input-group-addon">%</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">管理奖3代：</label>
                                    <div class="col-sm-8">
                                        <div class="input-group">
                                            <input id="rebate_5" name="rebate_5" type="text" class="form-control" required="" aria-required="true" onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" >
                                            <div class="input-group-addon">%</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-4 col-sm-offset-3">
                                        <button class="btn btn-primary" type="submit">确认提交</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
        </div>
    </div>
</div>


</div>
{include file="public/footer"}
<script>
    $('form').submit(function (e) {
        e.preventDefault();
        $.ajax({
            type:"post",
            url:"{:url('Level/LevelAdd')}",
            data:{
                name:$('#name').val(),
                recommend_count:$('#recommend_count').val(),
                rebate_1:$('#rebate_1').val(),
                rebate_2:$('#rebate_2').val(),
                rebate_3:$('#rebate_3').val(),
                rebate_4:$('#rebate_4').val(),
                rebate_5:$('#rebate_5').val(),
            },
            dataType:"json",
            success:function(data){
                if(data.status == 1){
                    layer.msg(data.message,{icon: 6,time:1500},function () {
                        window.top.location.reload();
                    });
                }else{
                    layer.msg(data.message,{icon: 5,time:1500});
                }
            }
        })
    })
</script>
</body>

</html>
